﻿@{
    Layout = "~/Views/Shared/_LoginLayout.cshtml";
    ViewBag.Title = "教务管理系统登录";
}
<style>
    .option-radio {
        display: none;
    }

        .option-radio + label {
            position: relative;
            height: 20px;
            width: 20px;
            border-radius: 50%;
            border: 2px solid #9a9a9a;
            background-color: transparent;
            display: inline-block;
            top: 5px;
        }

        .option-radio:checked + label {
            position: relative;
            height: 20px;
            width: 20px;
            border-radius: 50%;
            border: 2px solid #9a9a9a;
            background-color: transparent;
            display: inline-block;
            top: 5px;
        }

            .option-radio:checked + label:after {
                position: absolute;
                content: '';
                font-size: 0;
                border: 6px solid #9a9a9a;
                border-radius: 50%;
                top: 2px;
                left: 2px;
            }

        .option-radio:checked:disabled + label {
            border-color: #9a9a9a;
        }

            .option-radio:checked:disabled + label:after {
                border-color: #9a9a9a;
            }

        .option-radio:checked + label:hover, .option-radio + label:hover {
            cursor: pointer;
        }

        .option-radio:checked + label:active, .option-radio + label:active {
            filter: alpha(opacity=45);
            -moz-opacity: 0.45;
            -khtml-opacity: 0.45;
            opacity: 0.45;
        }

    .cc {
        margin-right: 10px;
    }
</style>
<div class="container loginbg">
    <div class="content">
        <div id="large-header" class="large-header" style="height: 305px;">
            <canvas id="login-canvas" width="1920" height="305"></canvas>
            <div class="logo_box">
                <h1 style="text-align:center">教务管理系统</h1>
                <form action="@Url.Action("Login")" name="form_login" id="form_login" method="post">
                    @Html.AntiForgeryToken()
                    <div class="input_outer" id="loginbox">
                        <span class="u_user"></span>
                        <input name="loginname" id="loginname" class="text" style="color: #FFFFFF !important" type="text" placeholder="请输入账户">
                    </div>
                    <div class="input_outer" id="pwdbox">
                        <span class="us_uer"></span>
                        <input name="password" id="password" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;" value="" type="password" placeholder="请输入密码">
                    </div>
                    <div class="input_outer" style="text-align:center;line-height:46px;" id="rdo">
                        <input type="radio" id="option-0-1" name="typeid" value="0" class="option-radio" checked />
                        <label for="option-0-1"></label>
                        <span class="cc">学生</span>
                        <input type="radio" id="option-0-2" name="typeid" value="1" class="option-radio" />
                        <label for="option-0-2"></label>
                        <span class="cc">主任</span>
                        <input type="radio" id="option-0-3" name="typeid" value="2" class="option-radio" />
                        <label for="option-0-3"></label>
                        <span class="cc">管理员</span>
                    </div>
                    <div class="mb2"><a id="btnlogin" class="act-but submit" href="javascript:;" style="color: #FFFFFF">登录</a></div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function ValiData(formData, jqForm, options) {
        var loginID = "#loginbox";
        var pwdID = "#pwdbox";
        var rdo = "#rdo";
        if (formData[1].value == "") {
            msg.tips('用户名不能为空！', loginID);
            return false;
        }
        if (formData[2].value == "") {
            msg.tips('密码不能为空！', pwdID);
            return false;
        }
        if (formData[3] == undefined || formData[2].value == "") {
            msg.tips('请选择登录身份！', rdo);
            return false;
        }

        return true;
    }
    function DoResult(responseText, statusText) {
        var code = responseText.Code;
        if (code == 100) {
            layer.msg(responseText.Message);
            return false;
        }
        if (code == 0) {
            window.location.href = 'About';
        }
        if (code == 1) {
            window.location.href = 'Contact';
        }
        if (code == 2) {
            window.location.href = 'Index';
        }
    }

    $(document).ready(function () {
        var btnsubmit = "#btnlogin";
        //
        $(btnsubmit).hover(function () {
            $(this).addClass('submitclick');
        },
            function () {
                $(this).removeClass('submitclick');
            });
        //
        $(btnsubmit).on("click", function () {
            var options = {
                beforeSubmit: ValiData,
                success: DoResult,
                // url : url,
                // type : type,
                //dataType: "json",
                // clearForm : true,
                // resetForm : true,
                timeout: 3000
            };
            $("#form_login").ajaxSubmit(options);
        });
        //
    });

</script>
